package com.yugao.fintech.antelope.base.datasource;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

/**
 * @deprecated
 */
@Slf4j
@Component
@RabbitListener(bindings = {
        @QueueBinding(
                // 切记: 此处无需设置队列名称，否在得话，多个消费者只有一个消费者能消费数据。其它消费者无法消费数据
                value = @Queue(durable = "true"),
                exchange = @Exchange(value = AppDeleteMQ.EXCHANGE, type = ExchangeTypes.FANOUT))
})
public class AppDeleteListener {
    @Autowired
    private CommonService commonService;

    @RabbitHandler
    public void onMessage(@Payload String msg, Channel channel, Message message) {
        log.info("消费删除应用消息, msg: {}", msg);
    }
}
